package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.Product;
import org.iabako.shared.entity.user.Enterprise;
import org.iabako.shared.iservice.generic.*;

import java.util.List;

/**
 * Created by jose on 16/01/15.
 */
public interface ProductServiceAsync extends SearchServiceAsync, SuggestServiceAsync, CRUDServiceAsync, BusinessEntityServiceAsync, TaxServiceAsync {

    void save(Product product, AsyncCallback<Product> async);

    void getProducts(AsyncCallback<List<Product>> async);

    void getByNumber(Enterprise enterprise, String number, AsyncCallback<Product> async);

    public static final class Util {
        private static ProductServiceAsync instance;

        public static final ProductServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(ProductService.class);
            }
            return instance;
        }
    }
}
